package day_2023_7_to_10;

/**
 * @author haomin
 * @date 2023/07/23 21:50
 **/
public class Day_7_23 {
    class Solution {
        public String reverseWords(String s) {
            StringBuffer sb = new StringBuffer();
            String[] arr = s.trim().split(" ");
            for(int i = arr.length-1; i >= 0; i--) {
                if (arr[i].length() == 0) continue;
                sb.append(arr[i]);
                if (i != 0) sb.append(" ");
            }
            return sb.toString();
        }
    }
}